package com.deyuans.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.deyuans.domian.Banktable;
import com.deyuans.mapper.BanktableMapper;
import com.deyuans.service.BanktableService;
import com.deyuans.uitls.R;
import org.springframework.stereotype.Service;


@Service
public class BanktableServiceImpl extends ServiceImpl<BanktableMapper,Banktable> implements BanktableService {


    @Override
    public R findcardtype(Banktable banktable) {
        if(banktable.getCardtype() ==null ){
            R r=new R();
            r.setCode(100);
            r.setMsg("卡号不能为空！");
            return r;
        }
        if(banktable.getCardnumber() ==null ){
            R r=new R();
            r.setCode(100);
            r.setMsg("身份号不能为空！");
            return r;
        }
        LambdaQueryWrapper<Banktable> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Banktable::getCardnumber,banktable.getCardnumber());
        wrapper.eq(Banktable::getCardtype,banktable.getCardtype());
        Banktable one = this.getOne(wrapper);
        if(one == null){
            R r=new R();
            r.setCode(200);
            r.setMsg("成功");
            return r;
        }
        R r=new R();
        r.setCode(100);
        r.setMsg("失败");
        return r;
    }


}
